home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / pcc / v04n12 / batch2.exe / MOVE.BAT < prev    next >
Encoding:
DOS Batch File  |  1991-10-10  |  2.0 KB  |  84 lines

  1. @ECHO OFF
  2. REM This is MOVE.BAT
  3. REM *** Replace the dummy directories in the next
  4. REM *** three lines with your own target directories
  5. REM *** Change just the part after the = sign!
  6. SET A=\ARCHIVE\
  7. SET B=\ARCHIVE\OLDFILES\
  8. SET C=\BACKUP\1991\
  9. FOR %%A IN (P p) DO IF %1!==%%A! GOTO LISTEM
  10. IF %2!==! GOTO OOPS1
  11. IF NOT EXIST %1 GOTO OOPS3
  12. SET TARG=%2
  13. FOR %%A IN (A a B b C c) DO IF %2!==%%A! GOTO %%A
  14. GOTO CHEK
  15. :A
  16. SET TARG=%A%
  17. GOTO CHEK
  18. :B
  19. SET TARG=%B%
  20. GOTO CHEK
  21. :C
  22. SET TARG=%C%
  23. :CHEK
  24. IF NOT EXIST %TARG%\%1 GOTO CHEK2
  25. ECHO %1 already exists in %TARG%
  26. ECHO Rename %1 and try again.
  27. GOTO END
  28. :CHEK2
  29. ECHO You're about to move %1 to %TARG%
  30. ECHO Press Y to do it, any other key to abort
  31. KEY
  32. IF ERRORLEVEL 89 IF NOT ERRORLEVEL 90 GOTO YES
  33. ECHO Aborting . . .
  34. GOTO END
  35. :YES
  36. XCOPY %1 %TARG% > NUL
  37. IF EXIST %TARG%\%1 GOTO WIPEIT
  38. ECHO Something's wrong. Aborting . . .
  39. GOTO END
  40. :WIPEIT
  41. DEL %1
  42. ECHO %1 now moved to %TARG%
  43. GOTO END
  44. :OOPS3
  45. ECHO %1 not found. Try another file.
  46. GOTO END
  47. :OOPS2
  48. ECHO %1 already exists in %TARG%
  49. GOTO END
  50. :LISTEM
  51. IF %A%%B%%C%!==! GOTO NOPRE
  52. ECHO Preset target directories:
  53. IF NOT %A%!==! ECHO A preset to %A%
  54. IF NOT %B%!==! ECHO B preset to %B%
  55. IF NOT %C%!==! ECHO C preset to %C%
  56. GOTO END
  57. :NOPRE
  58. ECHO No target directories preset
  59. GOTO END
  60. :OOPS1
  61. ECHO This will move files to from one
  62. ECHO directory to another. Enter:
  63. ECHO MOVE filename destination
  64. ECHO e.g. MOVE MYFILE \ARCHIVE\OLDFILES\
  65. ECHO                                   ^
  66. ECHO (By adding the final \ to the directory
  67. ECHO name you can have MOVE create the
  68. ECHO directory if it doesn't already exist.)
  69. ECHO.
  70. ECHO Or you can preset up to three
  71. ECHO target directories and move files into
  72. ECHO them by using A, B, or C as targets.
  73. ECHO So if youÆve set B to be \ARCHIVE2:
  74. ECHO copy files into \ARCHIVE2 by typing:
  75. ECHO MOVE MYFILE B
  76. ECHO.
  77. ECHO You can see your preset target
  78. ECHO directories by typing MOVE P
  79. :END 
  80. SET A=
  81. SET B=
  82. SET C=
  83. SET TARG=
  84.